﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="news.ascx.cs" Inherits="AnyOffice.general.mytable.news" %>
<script>
function open_news(news_id)
{
 URL="/general/news/show/read_news.aspx?news_id="+news_id;
 myleft=(screen.availWidth-500)/2;
 window.open(URL,"read_news","height=400,width=550,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,top=150,left="+myleft+",resizable=yes");
}

function re_news(news_id)
{
 URL="/general/news/show/re_news.aspx?news_id="+news_id;
 myleft=(screen.availWidth-500)/2;
 window.open(URL,"read_news","height=400,width=550,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,top=150,left="+myleft+",resizable=yes");
}
</script>
<div id="module_2"  style="position: relative;padding-bottom:10px;">
<table class="TableBlock" width="100%" cellspacing="0" cellpadding="2">
	<tr class="TableHeader">
		<td id="module_2_head" class="TableHeader" width="70%">
			<img src="/images/menu/news.gif" align="absMiddle"> 新闻
		</td>
		<td id="module_2_more" align="right">
			<div id="module_2_op" style="float:right;display:none;">&nbsp;<a id="module_2_url" href="#" onclick="_del('2');"><img border="0" src="/images/x.gif" alt="不显示该模块"></a></div>
			<div style="float:right"><a href="/general/news/show/index.aspx">全部</a>&nbsp;</div>
		</td>
	</tr>
	<tr class="TableData" style="background:#FFFFFF url(/images/water/news.jpg) no-repeat bottom right">
		<td colspan="2" height="60">			
			<div id="divNews">
			<asp:Repeater id="rptNews" runat="server" EnableViewState="False">
				<ItemTemplate>
				·<a href="javascript:open_news(<%#DataBinder.Eval(Container.DataItem,"NewsId")%>);">【<%#DataBinder.Eval(Container.DataItem,"TypeName")%>】<%#DataBinder.Eval(Container.DataItem,"Subject")%></a>&nbsp;
				<a href="javascript:re_news('<%#DataBinder.Eval(Container.DataItem,"NewsId")%>');" style="TEXT-DECORATION:underline">评论</a>&nbsp;
				(<%#Convert.ToDateTime(DataBinder.Eval(Container.DataItem,"SendTime")).ToString("yyyy-MM-dd")%>)<%#DataBinder.Eval(Container.DataItem,"Readers") != DBNull.Value ? GetNew(DataBinder.Eval(Container.DataItem,"Readers").ToString()) : "<img src=/images/new.gif align=absmiddle>"%>
				<br>
				</ItemTemplate>
			</asp:Repeater>
			<asp:Literal id="litNews" runat="server"></asp:Literal>
			</div>			
		</td>
	</tr>
</table>
</div>
<SCRIPT language="javascript">
CODE_IDSTR += "14,";
var timer_news = null;
var str_news = "";
function GetNews()
{	
	if(timer_news != null)
		window.clearTimeout(timer_news);
		
	AnyOffice.general.mytable.AjaxMethods.GetNews(CallBack_GetNews);
	timer_news=setTimeout("GetNews()",AJAX_INTERVAL*10);
}
function CallBack_GetNews(res)
{	
	if (res.error != null)  
		return;	
	if(str_news != res.value)	
		document.getElementById('divNews').innerHTML = res.value;
	str_news = res.value;
}
GetNews();
</SCRIPT>

